//节点的右键菜单定义&事件实现
function nodeRightMenu   (client,node)  {
    const menuItems = [
        {
            label: "实体详情",
            icon: 'el-icon-notebook-2',
            onClick: () => {
                client.showNodeDeteail();
            }
        },
        /****
        { 
            label: "扩展关系", 
            divided: true, 
            icon: "el-icon-search",
            onClick: () => {
                client.findRelation(node);
            }
        },
        { 
            label: "新建关系", 
            icon: "el-icon-connection",
            onClick: () => {
                client.addNodeConnect();
            }
        },
        { 
            label: "删除节点", 
            icon: "el-icon-delete",
            onClick: () => {
                client.deleteNode(node);
            }
        },
        {
            label: "辅助分析",
            icon: 'el-icon-data-analysis',
            minWidth: 0,
            children: [
                {
                    label: "选中关联节点",
                    icon: 'el-icon-magic-stick',
                    onClick: () => {
                        client.selectRelate();
                    }
                },
                {
                    label: "查找环路",
                    icon: 'el-icon-refresh-right',
                    onClick: () => {
                        client.findCycle();
                    }
                },
                {
                    label: "选中N度关系",
                    icon: 'el-icon-link',
                    children: [
                        {
                            label: "1度关系",
                            onClick: () => {
                                client.findNLevelRelations(node,1);
                            }
                        },
                        {
                            label: "2度关系",
                            onClick: () => {
                                client.findNLevelRelations(node,2);
                            }
                        },
                        {
                            label: "3度关系",
                            onClick: () => {
                                client.findNLevelRelations(node,3);
                            }
                        }
                    ]
                }
            ]
        }
         */
    ];

    return menuItems;
};

//连线的右键菜单定义&事件实现
function linkRightMenu  (client,link)  {
    const menuItems = [
        {
            label: "关系详情",
            icon: 'el-icon-notebook-2',
            onClick: () => {
                client.showLinkDetail();
            }
        },
        /***
        { 
            label: "删除关系", 
            icon: "el-icon-delete",
            onClick: () => {
                client.deleteLink(link);
            }
        },
        { 
            label: "关系设置", 
            icon: "el-icon-setting",
            onClick: () => {
                client.currentLink = link;
                client.relationSetDialog = true;
            }
        } */
    ];

    return menuItems;
};

//连线的右键菜单定义&事件实现
function sceneRightMenu   (client) {
    const menuItems = [
        {
            label: "框选节点分组",
            icon: 'el-icon-crop',
            onClick: () => {
                client.selectRegion();
            }
        },
        { 
            label: "清除全部分组", 
            icon: "el-icon-delete",
            divided:true,
            onClick: () => {
                client.clearGroup();
            }
        },
        { 
            label: "视图居中", 
            icon: "el-icon-full-screen",
            onClick: () => {
                client.graphVis.moveCenter();
            }
        },
        { 
            label: "清空数据", 
            icon: "el-icon-refresh",
            onClick: () => {
                client.graphVis.clearAll();
            }
        }
    ];

    return menuItems;
};

//连线的右键菜单定义&事件实现
function groupRightMenu   (client,group)   {
    const menuItems = [
        { 
            label: "删除分组", 
            icon: "el-icon-delete",
            divided:true,
            onClick: () => {
                client.deleteGroup(group);
            }
        },
        { 
            label: "组内布局", 
            icon: "el-icon-orange",
            minWidth: 0,
            children: [
                {
                    label: "环形布局",
                    icon: 'el-icon-aim',
                    onClick: () => {
                        client.groupLayout('circle');
                    }
                },
                {
                    label: "网格布局",
                    icon: 'el-icon-s-grid',
                    onClick: () => {
                        client.groupLayout('grid');
                    }
                },
                {
                    label: "同心圆布局",
                    icon: 'el-icon-bangzhu',
                    onClick: () => {
                        client.groupLayout('concentric');
                    }
                },
                {
                    label: "层级布局",
                    icon: 'el-icon-share',
                    onClick: () => {
                        client.groupLayout('hierarchical');
                    }
                },
                {
                    label: "网络布局",
                    icon: 'el-icon-orange',
                    onClick: () => {
                        client.groupLayout('fastForce');
                    }
                },
                {
                    label: "避免重叠",
                    icon: 'el-icon-menu',
                    onClick: () => {
                        client.groupLayout('avoidlap');
                    }
                }
            ]
        }
    ];

    return menuItems;
};

//获取右键菜单定义
function getElementRightMenu   (elementType, client,element)   {
    var rightMenus = [];
    switch (elementType) {
        case 'node':
            rightMenus = nodeRightMenu(client,element);
            break;
        case 'link':
            rightMenus = linkRightMenu(client,element);
            break;
        case 'group':
            rightMenus = groupRightMenu(client,element);
            break;
        case 'scene':
            rightMenus = sceneRightMenu(client);
            break;
        default:
            break;

    }
    return rightMenus;
};